$(function() {
	var hb_flag = 0
	var hb_num = 0
	$.post("selUserDoesExist", function(data) {
		if(data.code == 0) {
			hb_flag = 1
		} else {
			hb_flag = 0
		}
	})
	$.post("getFootballVoteAll", function(data) {
		if(data.code == 0) {

		} else {
			hb_num = 0
		}
	})
	$.post("footballTeampagingList", function(data) {
		if(data.code == 0) {
			let rel = data.data;
			let html = ''
			for(var i in rel) {
				html += '<li><div class="item"><img src="images/defImg.png" />';
				html += '<p class="text">' + rel[i].teamName + '</p>';
				html += '</div><span class="btn">支持</span></li>'
			}
			$(".banner").html(html)
		}
	})
	$(".banner").delegate('.btn', 'click', function() {
		var text = $(this).prev(".item").find(".text").text()
		if(hb_flag == 0) {
			$.confirm("您还未注册个人信息，请先进行注册", "注册信息", function() {
				window.location.replace("wx_cjxx")
			});
		} else {
			$.modal({
				title: "这是您支持的第" + Number(hb_num + 1) + "支球队",
				text: "您确定支持" + text + '进入八强吗？',
				buttons: [{
						text: "容我再想想",
						className: "default"
					},
					{
						text: "确定",
						onClick: function() {
							$(this).text("已知持")
//							abb(text)
						}
					},
				]
			});
		}
	})
	//球队投票
	function abb(row){
		$.post("addFootballVote",{footballTeams:row},function(data){
			if(data.code==0){
				$.toast(data.msg)
			}else{
				$.toast(data.msg, "forbidden");
			}
		})
	}
})